Skip to content

feat: batching execution (single iterator queries)#390

Merged
cheb0 merged 9 commits into
mainfrom
329-batching-1
Jun 5, 2026
Merged

feat: batching execution (single iterator queries)#390
cheb0 merged 9 commits into
mainfrom
329-batching-1

Conversation

@cheb0

@cheb0 cheb0 commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

Description

No significant perf improvement, just introduce new types: LIDBatch, BatchedNode. Batch mode enabled for single-iterator queries for sealed fractions.

iterateEvalTree is now works with batches. For one-by-one lid we batch them a bit, for batched flow we just bypass batches as is. To batch one-by-one eval tree lids, a buffer is used. It preallocated with 64k slots.

LIDBatch currently stores lids as []uint32 sorted asc. I had to introduce an unneeded copying from LID batch format to slice of node.LID so that we have a single iterateEvalTree function. It's a cost of avoiding code duplication.

single-iterator query perf

For single-iterator query we transfer batches directly. Hot query perf service:X (hist, total is 1.6 million):

main branch:
29.578 ms

PR:
23.854 ms

stopwatch eval_tree_next fixed

As part of the PR, stopwatch usage for eval_tree_next is adrressed. For low-cardinality query service:X AND level:4 (histogram) it reports the following numbers:

Search (hot) completed. Found 100 documents. Took: 15.812 ms
total >> iterate_eval_tree >> eval_tree_next -> 95.407644ms

With this PR:
Search (hot) completed. Found 100 documents. Took: 13.958 ms
total >> iterate_eval_tree >> eval_tree_next -> 5.5113ms

Part of #329


  • I have read and followed all requirements in CONTRIBUTING.md;
  • I used LLM/AI assistance to make this pull request;

@cheb0

cheb0 commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator Author

@seqbenchbot up main search-keyword-exact-match-warm

@seqbenchbot

seqbenchbot commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

Nice, @cheb0 <(-^,^-)=b!

Your request was successfully served.
Identificator for your ongoing benchmark - 73ed4722.

Here is a list of helpful links:

  • Take a look at Grafana dashboard;
  • Live-tailing logs are also available;

Have a great time!

@codecov-commenter

codecov-commenter commented Apr 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.23684% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.73%. Comparing base (b8c343e) to head (cc4076d).

Files with missing lines Patch % Lines
frac/processor/search.go 85.36% 8 Missing and 4 partials ⚠️
frac/sealed/lids/iterator_desc.go 69.56% 5 Missing and 2 partials ⚠️
frac/sealed/lids/iterator_asc.go 78.94% 3 Missing and 1 partial ⚠️
node/batch.go 81.81% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #390      +/-   ##
==========================================
+ Coverage   70.66%   70.73%   +0.07%     
==========================================
  Files         219      220       +1     
  Lines       17071    17183     +112     
==========================================
+ Hits        12063    12155      +92     
- Misses       4106     4124      +18     
- Partials      902      904       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

🔴 Performance Degradation

Some benchmarks have degraded compared to the previous run.
Click on Show table button to see full list of degraded benchmarks.

Show table
Name Previous Current Ratio Verdict
MutexListAppend-4 5115f7 f70ec9
196.07 MB/s 177.02 MB/s 0.90 🔴

@cheb0

cheb0 commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator Author

@seqbenchbot down 73ed4722

@seqbenchbot

seqbenchbot commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

Nice, @cheb0 <(-^,^-)=b!

The benchmark with identificator 73ed4722 was finished.
I've prepared a summary for you. Click on Show summary button to see it:

Show summary
Query Type mean (ms) stddev (ms) p(50) (ms) p(95) (ms) p(99) (ms) iterations
base comp diff base comp diff base comp diff base comp diff base comp diff base comp diff
bulk
warm 68.99 68.64 -0.50% 24.66 24.92 +1.08% 63.00 62.00 -1.59% 118.50 117.00 -1.27% 158.50 154.00 -2.84% 2450.00 2450.00 0.00%
service:payment-backend-eu
AND k8s_namespace:prod
warm 123.87 124.02 +0.12% 113.56 116.60 +2.68% 115.00 113.00 -1.74% 223.00 221.00 -0.90% 731.50 759.50 +3.83% 3979.00 3958.00 -0.53%

Have a great time!

@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

🔴 Performance Degradation

Some benchmarks have degraded compared to the previous run.
Click on Show table button to see full list of degraded benchmarks.

Show table
Name Previous Current Ratio Verdict
MutexListAppend-4 5115f7 c14eb6
196.07 MB/s 163.95 MB/s 0.84 🔴
83287562.00 ns/op 97590828.00 ns/op 1.17 🔴

@eguguchkin eguguchkin requested review from eguguchkin and forshev April 6, 2026 10:20
@eguguchkin eguguchkin modified the milestones: v0.72.0, v0.73.0 Apr 13, 2026
cheb0 added 2 commits April 18, 2026 18:54
# Conflicts:
#	frac/processor/search.go
Comment thread frac/processor/search.go Outdated
Comment thread frac/processor/search.go Outdated
@cheb0 cheb0 added the performance Features or improvements that positively affect seq-db performance label May 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔴 Performance Degradation

Some benchmarks have degraded compared to the previous run.
Click on Show table button to see full list of degraded benchmarks.

Show table
Name Previous Current Ratio Verdict
MutexListAppend-4 e0cf43 9b8054
218.29 MB/s 194.71 MB/s 0.89 🔴

@eguguchkin eguguchkin modified the milestones: v0.73.0, v0.72.0 May 18, 2026
@cheb0 cheb0 merged commit 16e36dd into main Jun 5, 2026
8 checks passed
@cheb0 cheb0 deleted the 329-batching-1 branch June 5, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Features or improvements that positively affect seq-db performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants